<% @page_title = "Procura de Usuários" %>

<% form_for :user, :url => { :action => :list_users} do |form| %>
  <p>
    Nome:   <%= form.text_field :name, :size => 30  %>
  </p>
  <p>
    Telefone:   <%= form.text_field :phone, :size => 30  %>
  </p>
  <p>
    Celular:   <%= form.text_field :cell, :size => 30  %>
  </p>
  <p>
    Email:   <%= form.text_field :email, :size => 30  %>
  </p>
  <p>
    <%= submit_tag 'Procurar'%>
  </p>

<% end %>


<h1>Lista de Usuários</h1>

<table>
  <tr>
    <th>Nome</th>
    <th>Telefone</th>
    <th>Celular</th>
    <th>Email</th>
  </tr>

<% for user in @users %>
  <tr>
    <td><%=h user.name %></td>
    <td><%=h user.phone %></td>
    <td><%=h user.cell %></td>
    <td><%=h user.email %></td>
    <td><%= link_to 'Visualizar', user %></td>
    <td><%= link_to 'Editar', edit_user_path(user) %></td>
    <td><%= link_to 'Excluir', user, :confirm => "Deseja realmente excluir #{user.name}?", :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'Criar usuário', new_user_path %>
